<%@page import="org.webcamp.settings.dto.Settings"%>
<%@page import="org.webcamp.users.dto.User"%>
<% User user = (User) session.getAttribute("user"); 
   if (user == null || !user.getName().equals("admin")){
	   response.sendRedirect("selection.do");
	   return;
   }
%>
<%@include file="header.jsp"%>
<% Settings settings = (Settings) request.getAttribute("settings"); %>

	<table class="table table-striped table-hover">
	<% for (String name : Settings.SETTINGS_NAMES){ %>
		<tr style="margin: 5px;">	
		<form method="post" role="form" action="apply_settings.do">
			<td>
				<label ><%=name%></label> 
			</td>
			<td>
				<input type="hidden" name="name" value="<%=name%>" />
				<input type="text"
					   class="form-control" 
					   name="value"
					   placeholder="Enter Setting" 
					   value="<%=settings.getSetting(name)%>">
			</td>
			<td>
				<button type="submit" class="btn btn-primary btn-sm">Apply</button>
			</td>
		</form>
		</tr>	
	
	<%} %>
	</table>

<%@include file="footer.jsp"%>
